<?php
/**
 * 批量发送邮件
 * 读文件中的邮件,存在数组里了,用163的邮件发送
 * 
 * 发送用的是163的服务器,会有限制，所以每个邮件可以发20次，每封发40个地址
 */
exit("处理好");
set_time_limit(0);
$s8 = microtime(true);
ini_set('date.timezone', "Asia/Shanghai");

$fp = fopen("status_".date("H_i_s").".txt", "a");//将当前的状态写入文件
include 'libEmail/phpmailer.php';
include 'libEmail/pop3.php';
include 'libEmail/smtp.php';

$host_email_address = array(
	array("Host"=>"smtp.163.com","userNmae"=>"asdf23r2w@163.c​om","pwd"=>"asf34turty45","displayName"=>"周六粉"),
	array("Host"=>"smtp.163.com","userNmae"=>"itylw_com_cn@163.c​om","pwd"=>"121as34f434f","displayName"=>"周六粉"),
	array("Host"=>"smtp.163.com","userNmae"=>"q3admin_c_abc@163.c​om","pwd"=>"asdf2rf23f2","displayName"=>"周六粉"),
	array("Host"=>"smtp.163.com","userNmae"=>"asdwf434t3g@163.c​om","pwd"=>"4r23r23r23d","displayName"=>"周六粉"),
	array("Host"=>"smtp.163.com","userNmae"=>"xcvwewev2323@163.c​om","pwd"=>"zxcvwfwgwgeg","displayName"=>"周六粉"),
	array("Host"=>"smtp.163.com","userNmae"=>"fvb34t3434@163.c​om","pwd"=>"sdf3r23r23","displayName"=>"周六粉"),
	array("Host"=>"smtp.163.com","userNmae"=>"asdfxcw3434334@163.c​om","pwd"=>"sdfr234r23r23","displayName"=>"周六粉"),
	array("Host"=>"smtp.163.com","userNmae"=>"xwsh34@163.c​om","pwd"=>"sdww42342w","displayName"=>"周六粉"),
	array("Host"=>"smtp.163.com","userNmae"=>"xswsh34@163.c​om","pwd"=>"xdwer52323","displayName"=>"周六粉"),
	array("Host"=>"smtp.163.com","userNmae"=>"sre334xswsh34@163.c​om","pwd"=>"svet34t3tdf","displayName"=>"周六粉"),
	//array("Host"=>"smtp.163.com","userNmae"=>"aaaaaaaa@163.c​om","pwd"=>"bbbbbb","displayName"=>"周六粉"),
	
	//qq邮箱
	array("Host"=>"smtp.qq.com","userNmae"=>"2684603965@qq.com","pwd"=>"6s5df5s5d5s6sd55d5","displayName"=>"周六粉"),
	array("Host"=>"smtp.qq.com","userNmae"=>"2647992425@qq.com","pwd"=>"peng123456","displayName"=>"周六粉"),
	array("Host"=>"smtp.qq.com","userNmae"=>"2632164105@qq.com","pwd"=>"1234567890","displayName"=>"周六粉"),
	array("Host"=>"smtp.qq.com","userNmae"=>"1413180202@qq.com","pwd"=>"1234567890","displayName"=>"周六粉"),
	//array("Host"=>"smtp.qq.com","userNmae"=>"aaaaaaaa@qq.com","pwd"=>"bbbbbb","displayName"=>"周六粉"),

);

$email_c = 0;//地址数
$email_max = 1;//每个邮件可以发20次
$email_count_address = 40;//40个地址发一封

$body = <<<eot
<HTML><BODY>
<h1><a style="text-decoration:none;" href="http://www.itylw.com/m/l.php" target="_blank">图片欣赏</a></h1>
<hr style="height:0;border-style:dashed;border-width:1px 0 0;margin:12px 0 18px;">
	
<p style="color:#555555;font-family:'Helvetica Neue', HelveticaNeue, Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;line-height:32px;text-indent:32px;white-space:normal;background-color:#FFFFFF;">
她们接戏也很受限制，无论到哪里都被贴着“事业线”的标签。所以为了星途坦荡，。这大概让 “一马平川”的妹子们听着伤心了，但不得不承认，她反而是这些大胸演员里面发展最好的一位。不偏题了，我们的主要目的还是要饱个眼福先。同时，也要向她们表示敬意，不管是hold不住的御姐型，还是美胸胜过了演技，不得不承认，养眼也是她们。。。。。<a href="http://www.itylw.com/m/l.php" target="_blank">查看更多图片</a>
</p>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="闫妮穿衣不慎疑似凸点内裤勒痕清晰可见[12]"><img src="http://www.itylw.com/img/rm/10630.jpg"/></a>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="我最喜欢的成熟之美，气质非凡[32]"><img src="http://www.itylw.com/img/rm/10685.jpg"/></a></p>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="窈窕性感妩媚  [10]"><img src="http://www.itylw.com/img/rm/10663.jpg"/></a></p>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="性感的吊带美媚...[13]"><img src="http://www.itylw.com/img/rm/10605.jpg"/></a></p>
<p><a href="http://www.itylw.com/m/l.php" target="_blank" title="这样的夜店，这样的美女[40]"><img src="http://www.itylw.com/img/rm/10370.jpg"/></a></p>
<div style="border-top: 2px solid #00A6FC; padding: 10px 0;">
<p>
	<a href="http://www.itylw.com/news/view/id/10105.php" target="_blank"><img src="http://www.itylw.com/upload/s/10-breast-a.jpg"></a>
	<a href="http://www.itylw.com/news/view/id/10105.php" target="_blank"><img src="http://www.itylw.com/upload/s/10-breast-b.jpg"></a> 
</p>

<p style="color:#000;">请不要回复此邮件!您可以回复到<strong>itylw_admin@163.com</strong></p>
<img src="http://www.itylw.com/t/c.php?i=2"/>
</div>
</BODY></HTML>
eot;

include "ARRAY0.php";
$success=0;$faile=0;$i=0;$count=0;$imode=0;$temp_send_email=0;
foreach($email_all_array as $value){
	$count++;
	if(!isset($mail)){
		$mail = new mailer_phpmailer();
		$mail->IsSMTP();
		$mail->SMTPDebug = 1;
		$mail->SMTPAuth = true;
		$mail->CharSet = "utf-8";
		
		$temp_send_email++;
		if($temp_send_email>=$email_max)
			$email_c++;
		if(!isset($host_email_address[$email_c])){
			break;
		}
		
		$mail->Host = $host_email_address[$email_c][2];
		$mail->Port = 25;
		$mail->Username = $host_email_address[$email_c][0];
		$mail->Password = $host_email_address[$email_c][1];
		$mail->SetFrom($host_email_address[$email_c][0], "it娱乐网");
		
		$mail->Subject = "你好_这是我的_".rand(1,9999)."_也是你的";
		$mail->MsgHTML($body);
		$mail->AddAddress($value, null);
	}
	
	$mail->AddBCC($value, null);
	
	if($count%$email_count_address==0){
		if($mail->Send() === true)
			$success++;
		else 
			$faile++;
		
		$i++;
		$end8 = date("Y-m-d H:i:s");
		fwrite($fp, "i1:{$i},s:{$success},f:{$faile},D:{$end8},{$value}|,");
		unset($mail);
		sleep(2);
	}
}
if(isset($mail))
	$mail->Send();

echo "成功:".$success."失败:".$faile;
echo "<br>用时:".number_format(microtime(true) - $s8, 3, '.', '')."秒";